<!DOCTYPE html>
<html lang=zh>
<head><meta name="generator" content="Hexo 3.9.0">
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="前言我欠博客一个解释，为啥这么久都不更新 😂，好吧，人变懒了…讲下最近我服务器出现的一个事吧，某日我为了方便查看数据，在腾讯云服务器上把 27017 端口给开放了，然后过了两天，需求方和我说小程序出了问题。我一查就发现数据库里的数据都被人删除光了 😭，而我正好又没做好备份，然后花了很长时间去重建数据。 这件事反应了两个问题，第一：如果数据库允许远程访问一定要做好用户权限的设置，不能让人随意修改">
<meta name="keywords" content="mongodb">
<meta property="og:type" content="article">
<meta property="og:title" content="mongo自动备份">
<meta property="og:url" content="https://andyliwr.github.io/2018/06/11/mongo_auto_backup/index.html">
<meta property="og:site_name" content="月光倾城的代码小屋">
<meta property="og:description" content="前言我欠博客一个解释，为啥这么久都不更新 😂，好吧，人变懒了…讲下最近我服务器出现的一个事吧，某日我为了方便查看数据，在腾讯云服务器上把 27017 端口给开放了，然后过了两天，需求方和我说小程序出了问题。我一查就发现数据库里的数据都被人删除光了 😭，而我正好又没做好备份，然后花了很长时间去重建数据。 这件事反应了两个问题，第一：如果数据库允许远程访问一定要做好用户权限的设置，不能让人随意修改">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-01-15T06:30:09.116Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="mongo自动备份">
<meta name="twitter:description" content="前言我欠博客一个解释，为啥这么久都不更新 😂，好吧，人变懒了…讲下最近我服务器出现的一个事吧，某日我为了方便查看数据，在腾讯云服务器上把 27017 端口给开放了，然后过了两天，需求方和我说小程序出了问题。我一查就发现数据库里的数据都被人删除光了 😭，而我正好又没做好备份，然后花了很长时间去重建数据。 这件事反应了两个问题，第一：如果数据库允许远程访问一定要做好用户权限的设置，不能让人随意修改">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>mongo自动备份</title>
    <!-- styles -->
    <link rel="stylesheet" href="/css/style.css">
    <!-- persian styles -->
    
      <link rel="stylesheet" href="/css/rtl.css">
    
    <!-- rss -->
    
    
</head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2018/06/14/css_generate_arrow/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2018/05/07/koa_static_file_server/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&text=mongo自动备份"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&is_video=false&description=mongo自动备份"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=mongo自动备份&body=Check out this article: https://andyliwr.github.io/2018/06/11/mongo_auto_backup/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&name=mongo自动备份&description="><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#介绍mongodump"><span class="toc-number">2.</span> <span class="toc-text">介绍mongodump</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#自动执行脚本"><span class="toc-number">3.</span> <span class="toc-text">自动执行脚本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#自动运行"><span class="toc-number">4.</span> <span class="toc-text">自动运行</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#结束"><span class="toc-number">5.</span> <span class="toc-text">结束</span></a></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        mongo自动备份
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">月光倾城的代码小屋</span>
      </span>
      
    <div class="postdate">
        <time datetime="2018-06-11T23:59:23.000Z" itemprop="datePublished">2018-06-11</time>
    </div>


      

      
    <div class="article-tag">
        <i class="fas fa-tag"></i>
        <a class="tag-link" href="/tags/mongodb/">mongodb</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h4 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h4><p>我欠博客一个解释，为啥这么久都不更新 😂，好吧，人变懒了…<br>讲下最近我服务器出现的一个事吧，某日我为了方便查看数据，在腾讯云服务器上把 27017 端口给开放了，然后过了两天，需求方和我说小程序出了问题。我一查就发现数据库里的数据都被人删除光了 😭，而我正好又没做好备份，然后花了很长时间去重建数据。</p>
<p>这件事反应了两个问题，第一：如果数据库允许远程访问一定要做好用户权限的设置，不能让人随意修改，第二：重要的数据一定要做好备份，防止万一出了问题造成的损失。</p>
<p>不扯了，进入今天的主题吧—如何自动备份<code>mongo</code>。</p>
<h4 id="介绍mongodump"><a href="#介绍mongodump" class="headerlink" title="介绍mongodump"></a>介绍<code>mongodump</code></h4><p><code>mongodump</code> 是 <code>MongoDB</code> 提供的一个工具，用于备份数据库，配合使用 <code>mongorestore</code>恢复工具使用。这套工具适合小型应用或开发环境。</p>
<p>运行 <code>mongodump</code> 和 <code>mongorestore</code> 时需要读取正在运行的数据库实例，因此会影响数据库性能。一方面是运行时需要占用系统资源，另一方面，运行这两个命令时数据库会强制通过内存读取所有数据，可能导致读取的不常用数据覆盖常用数据，从而影响数据库日常运行的性能。</p>
<p>关于它们的用法举个栗子：</p>
<figure class="highlight angelscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 从本地恢复数据库</span><br><span class="line">mongorestore -h localhost:<span class="number">27017</span> -d mbook -u admin -p <span class="number">123456</span> 本地数据库地址</span><br><span class="line"># 备份数据库到本地</span><br><span class="line">mongodump -h localhost:<span class="number">27017</span> -d mbook -u admin -p <span class="number">123456</span> -o 需要存储的本地目录</span><br></pre></td></tr></table></figure>
<h4 id="自动执行脚本"><a href="#自动执行脚本" class="headerlink" title="自动执行脚本"></a>自动执行脚本</h4><p>首先我们要创建一个执行备份工作的脚本。在 <code>~/crontab/</code> 下新建一个 <code>.sh</code> 文件：</p>
<figure class="highlight vim"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> -<span class="keyword">p</span> ~/crontab</span><br><span class="line"><span class="keyword">vi</span> ~/crontab/mongod_bak.<span class="keyword">sh</span></span><br></pre></td></tr></table></figure>
<p>写入以下内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/sh</span></span><br><span class="line">DUMP=mongodump</span><br><span class="line">OUT_DIR=/data/backup/mongod/tmp   // 备份文件临时目录</span><br><span class="line">TAR_DIR=/data/backup/mongod       // 备份文件正式目录</span><br><span class="line">DATE=`date +%Y_%m_%d_%H_%M_%S`    // 备份文件将以备份时间保存</span><br><span class="line">DB_USER=&lt;USER&gt;                    // 数据库操作员</span><br><span class="line">DB_PASS=&lt;PASSWORD&gt;                // 数据库操作员密码</span><br><span class="line">DAYS=14                           // 保留最新14天的备份</span><br><span class="line">TAR_BAK=<span class="string">"mongod_bak_<span class="variable">$DATE</span>.tar.gz"</span> // 备份文件命名格式</span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$OUT_DIR</span>                       // 创建文件夹</span><br><span class="line">rm -rf <span class="variable">$OUT_DIR</span>/*                 // 清空临时目录</span><br><span class="line">mkdir -p <span class="variable">$OUT_DIR</span>/<span class="variable">$DATE</span>           // 创建本次备份文件夹</span><br><span class="line"><span class="variable">$DUMP</span> -u <span class="variable">$DB_USER</span> -p <span class="variable">$DB_PASS</span> -o <span class="variable">$OUT_DIR</span>/<span class="variable">$DATE</span>  // 执行备份命令</span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$TAR_DIR</span></span><br><span class="line">tar -zcvf <span class="variable">$TAR_BAK</span> <span class="variable">$OUT_DIR</span>/<span class="variable">$DATE</span>       // 将备份文件打包放入正式目录</span><br><span class="line">find <span class="variable">$TAR_DIR</span>/ -mtime +<span class="variable">$DAYS</span> -delete             // 删除14天前的旧备份</span><br></pre></td></tr></table></figure>
<p>这个脚本完成了备份、打包、删除一定时间之前旧备份的工作。注意其中的<code>user</code>需要具有对希望备份的数据库具有<code>find</code>操作权限。<br>保存好脚本后别忘了将它设为可执行：</p>
<figure class="highlight arcade"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod +x ~<span class="regexp">/crontab/m</span>ongod_bak.sh</span><br></pre></td></tr></table></figure>
<p>现在你可以试着执行一下<code>./mongod_bak.sh</code>，就会在备份文件夹中看到打包好的备份数据了。</p>
<h4 id="自动运行"><a href="#自动运行" class="headerlink" title="自动运行"></a>自动运行</h4><p>备份脚本写好之后，就需要让它自动运行。直接使用 Linux 的 crontab 命令即可：</p>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vi <span class="regexp">/etc/</span>crontab</span><br></pre></td></tr></table></figure>
<p>在底部添加：</p>
<figure class="highlight basic"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">0 </span><span class="number">2</span> * * * root ~/crontab/mongod_bak.sh</span><br></pre></td></tr></table></figure>
<p>这一行表示在每天凌晨 02:00 以 root 身份运行备份数据库的脚本。然后重启 crond 使其生效：</p>
<figure class="highlight cs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo /etc/init.d/cron restart</span><br><span class="line">chkconfig crond <span class="keyword">on</span>  <span class="comment">// 设为开机启动</span></span><br></pre></td></tr></table></figure>
<h4 id="结束"><a href="#结束" class="headerlink" title="结束"></a>结束</h4><p>文章摘抄至<a href="https://brickyang.github.io/2017/03/02/Linux-%E8%87%AA%E5%8A%A8%E5%A4%87%E4%BB%BD-MongoDB/" target="_blank" rel="noopener">全栈渐进之路</a></p>

  </div>
  <div class="statement">
    <hr>  
    1. 如果本文帮到了您，不妨点一下右上角的”<i class="fas fa-share-alt"></i>“按钮。<br>
    2. 除非注明，本博文章均为原创，转载请以链接形式标明本文地址。<br>
    3. 如果你有任何疑问，欢迎发送邮件到我的邮箱<a href="mailto:andyliwr@outlook.com">andyliwr@outlook.com<br>
  </div>
</article>


    <div class="blog-post-comments">
        <div id="gitalk_thread">
            <noscript>加载评论需要在浏览器启用 JavaScript 脚本支持。</noscript>
        </div>
    </div>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#介绍mongodump"><span class="toc-number">2.</span> <span class="toc-text">介绍mongodump</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#自动执行脚本"><span class="toc-number">3.</span> <span class="toc-text">自动执行脚本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#自动运行"><span class="toc-number">4.</span> <span class="toc-text">自动运行</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#结束"><span class="toc-number">5.</span> <span class="toc-text">结束</span></a></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&text=mongo自动备份"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&is_video=false&description=mongo自动备份"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=mongo自动备份&body=Check out this article: https://andyliwr.github.io/2018/06/11/mongo_auto_backup/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&title=mongo自动备份"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/06/11/mongo_auto_backup/&name=mongo自动备份&description="><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Dikang Li
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
</body>
</html>
<!-- styles -->
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">
<link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">

<link rel="stylesheet" href="https://file.lantingshucheng.com/blog/v3/static/styles/gitalk.css">


<!-- jquery -->
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>
<script src="/lib/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/md5.js"></script>
<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/gitalk.min.js"></script>

<script src="/js/main.js"></script>
<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?7851ca7a86be957be994acb77639a5be";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


  <script type="text/javascript">
    window.onload = function(){
      if (window.location.href.indexOf('andyliwr.github.io') > -1) {
        var gitalk = new Gitalk({
          clientID: 'ad6f70df0c70d2b715f9',
          clientSecret: '40384bee244c1e17dd7c37733d21e9ef669e969c',
          repo: 'Andyliwr.github.io',
          owner: 'Andyliwr',
          admin: ['Andyliwr'],
          id: md5(location.pathname),
          distractionFreeMode: 'true'
        })
        gitalk.render('gitalk_thread')
      }
    }
  </script>


